package Crad;

public class Crad {
    private String  id;
    private String pwd;
    private double count=1000;

    public String  getId() {
        return id;
    }

    public void setId(String id) {
        if(id.length()==19){
            this.id = id;
            System.out.println("账号为："+this.id);
        }else{
            this.id="0";
            System.out.println("输入卡号不合法，请重新输入");
        }
        
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        if(pwd.length()==6){
            this.pwd = pwd;
            System.out.println("密码为"+this.pwd);
        }else{
            this.pwd="0";
            System.out.println("输入密码不合法，请重新输入");
        }

    }

    public double getCount() {
        return count;
    }

    public void setCount(double count) {
        if(count>0&&count<10000){
            this.count = count+this.count;
            System.out.println("余额为"+this.count+"存入"+count);
        }else if(count>=10000){
            this.count=award(count)+this.count;
            System.out.println("余额为："+this.count+"存入"+count+"银行奖励"+(this.count-count));
        }else if(count<0&&count<this.count){
            //取入0元
            this.count=this.count+count;
            System.out.println("余额为"+this.count+"取出"+count);

        }

    }
//  当存入余额大于10000时给余额增加%0.1
    private double award(double sum) {
        sum=sum*0.001+sum;
        return sum;
    }

}
